<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数的方法</title>

    <script type="text/javascript">
        function fun(a, b) {
            console.log(this.name);
            console.log("a = " + a);
            console.log("b = " + b);
        }

        var obj = {name: "obj"};
        var obj2 = {name: "obj2"};

        fun.call(obj, 2, 3);
        fun.apply(obj2, [3, 4]);
    
    </script>

</head>

<body>

</body>

</html>